#透视变换
import cv2
import numpy as np

img = cv2.imread('surprise.jpg')

M = cv2.getPerspectiveTransform(np.float32([[0,0],[300,0],[0,300],[300,300]]), np.float32([[0,0],[300,0],[0,300],[300,300]])

cv2.warpPerspective(img, M, (w, h))